﻿using System.Xml;
using SdmxMl.Helper;
using SdmxMl.Common;

namespace SdmxMl.Structure
{

    /// <summary>
    /// Representation Reference
    /// </summary>
    public class RepresentationReference : ArtefactRefBase
    {
        #region Internal Members

        #endregion //Internal Members

        #region Construction

        public RepresentationReference()
        {
        }

        public RepresentationReference(XmlNode nodeArtefact, XmlNamespaceManager nsmgr)
        {
            Id = Xmlhelper.GetAtt(nodeArtefact, "representationScheme");
            Version = Xmlhelper.GetAtt(nodeArtefact, "representationSchemeVersion");
            AgencyId = Xmlhelper.GetAtt(nodeArtefact, "representationSchemeAgency");
        }

        #endregion //Construction

        #region XML Representation

        public void WriteXml(XmlTextWriter xw)
        {
            Xmlhelper.WriteAttributeIfExist(xw, "representationScheme", Id);

            if (Version != "1.0")
                Xmlhelper.WriteAttributeIfExist(xw, "representationSchemeVersion", Version);
            Xmlhelper.WriteAttributeIfExist(xw, "representationSchemeAgency", AgencyId);
        }

        #endregion //XML Representation
    }


}
